import pageination from '../../components/pageination/pageination.vue'
export default {
	data() {
			return {
				userData: [],
				//数据
				total: 0, //总条数
				page: 1, //当前页
				size: 10, //每页显示条数
        search: '',
        articleList: [] //评论信息
			}
		},
		components: {
			pageination
		},
		created() { //调用方法
			let that = this;
		},
		mounted() {},
		methods: { //写函数方法
			getData: function() {
				let that = this;
				that.$post(
						that.urls.getArticleCountPageInfo, {
							"topicSearch": that.search,
						  "pageNum": that.page,
							"pageSize": that.size
						}
					)
					.then(function(res) {
						if (res.success) {
							that.articleList = res.pageInfo.list;
							that.page = res.pageInfo.pageNum;
							that.total = res.pageInfo.total;
						}
					})
			},
			//页码切换执行方法
			pageFn: function(val, pid) {
				this.page = parseInt(val);
				this.getData();
				//此处调列表数据接口
				//	this.searchTodo(pid); //查询新闻
			},

			toDateStr(timestamp) {
				let time = new Date(timestamp) // 先将时间戳转为Date对象，然后才能使用Date的方法
				let year = time.getFullYear(),
					month = time.getMonth() + 1, // 月份是从0开始的
					day = time.getDate();
				//  hour = time.getHours(),
				//  minute = time.getMinutes(),
				//  second = time.getSeconds();
				//  return year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;
				return year + '-' + month + '-' + day;
			},
			searchUser: function() {
				let that = this;
				let value = $('#searchUserVal').val();
				that.$post(
						that.urls.findAllUser, {
							"pageNum": that.page,
							"pageSize": that.size,
							userName: value
								//	"userPhoneNumber": parseInt(value),
						}
					)
					.then(function(res) {
						if (res.success) {
							that.userData = res.pageInfo.list;
							that.page = res.pageInfo.pageNum;
							that.total = res.pageInfo.total;

						}
					})

			},
			//查看详情
			toCommentManagement: function(id) {
        if (id == null) {
          return;
        }
        this.set("topicDetailid", id);
			  this.$router.push({
					path: "/commentManagementDetail",
				})
			},
		}
}
